home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_370 / sksh / check_1.5.sksh < prev    next >
Text File  |  1992-05-06  |  9KB  |  281 lines

  1.  
  2. b="$_ANSI_P3"
  3. e="$_ANSI_P1"
  4.  
  5. missing="ram:.missing"
  6. invalid="ram:.invalid"
  7. inpath="ram:.inpath"
  8.  
  9. function clean_up {
  10.    rm "$missing" "$invalid" "$inpath"
  11.    cd "$orig_dir"
  12. }
  13.  
  14. function check_files {
  15.  
  16.    if [ ! -f "$1" ]
  17.    then
  18.       echo -c "$b" "ERROR: " "$e" "this file is missing: $1"
  19.       echo "$1" >> "$missing"
  20.    else
  21.       crcval=$("$crccmd" -q "$1")
  22.  
  23.       if [ "$crcval" != "$2" ]
  24.       then
  25.          echo -c "$b" "ERROR: " "$e" "this file has an incorrect checksum: $1"
  26.          echo "$1" >> "$invalid"
  27.       fi
  28.  
  29.       if [ "$3" = "pure" -a ! -P "$1" ]
  30.       then
  31.          echo -c "$b" "WARNING: " "$e" "this file should have the pure bit set: $1"
  32.       fi
  33.  
  34.       if [ "$r" = "path" -a ! -z $(which -s "$1") ]
  35.       then
  36.          echo -c "$b" "ERROR: " "$e" "this file must be in your SKsh path: $1"
  37.          echo "$1" >> "$inpath"
  38.       fi
  39.    fi
  40. }
  41.  
  42.  
  43. function read_dir {
  44.  
  45.    local in_dir; in_dir=''
  46.  
  47.    cd $orig_dir
  48.  
  49.    while [ ! -d "$in_dir" -o -z "$in_dir" ]
  50.    do
  51.       echo
  52.       echo "$1"
  53.       echo -n "$2" "$b\[$3]$e ? > "
  54.  
  55.       read read_dir
  56.       eval "in_dir = $read_dir"     # to get filename mapping right
  57.  
  58.       if [ -z "$in_dir" ]; then in_dir = "$3"; fi
  59.  
  60.       if [ ! -d "$in_dir" ]
  61.       then
  62.          echo "\n$read_dir is not a valid directory name."
  63.       fi
  64.    done
  65.  
  66.    export -l in_dir
  67. }
  68.  
  69. clear
  70.  
  71. if [ $(version -s) -lt 6 ]
  72. then
  73.    echo "This script must be run under SKsh 1.5 or later.  Please install"
  74.    echo "SKsh 1.5, run it, and then run this script."
  75.    echo
  76.    return
  77. fi
  78.  
  79. echo '
  80. This script will verify the installation of SKsh 1.5.  It will report
  81. missing files, files which do not have the correct checksum for this
  82. version of SKsh, files which should have the pure bit set bit don\'t,
  83. and files which should be in the search path but are not.  It will prompt
  84. you for the location of various commands.  You must enter a valid
  85. directory name which contains the files; for example, you might
  86. enter "c:" (without the quotes) for the location of the main SKsh
  87. binaries, and "sys:bin" for the location of the SKsh external commands.
  88.  
  89. This script is a reporting tool only; it will not change your filesystem.
  90. '
  91.  
  92. if [ ! -m 'ram:' ]
  93. then
  94.    echo "The volume ram: must be mounted for this script to run.\n"
  95.    return
  96. fi
  97.  
  98. if [ ! -m 'sksh:' ]
  99. then
  100.    echo "The volume sksh: must be mounted.\n"
  101.    return
  102. fi
  103.  
  104. if [ ! -m 'vmagic:' ]
  105. then
  106.    echo -c "$b" "WARNING: " "$e" "the volume vmagic: should be mounted.\n"
  107. fi
  108.  
  109. crccmd=$(which -s crc)
  110. if [ -z "$crccmd" ]
  111. then
  112.    echo "The 'crc' command was not found in your SKsh search path.  It must"
  113.    echo "be there for this script to run correctly."
  114.    echo
  115.    return
  116. fi
  117.  
  118. orig_dir="$PWD"
  119.  
  120. echo -n > "$missing"
  121. echo -n > "$invalid"
  122. echo -n > "$inpath"
  123.  
  124. # --- Find dir containing sksh binary... -------------------------------------
  125.  
  126. read_dir "Please enter the name of the directory which contains the SKsh and" \
  127.          "Tiny_SKsh binaries" "c:"
  128.  
  129. echo -c "\n$_ANSI_US" "Checking SKsh binaries and init files...$_ANSI_UE" "\n"
  130. cd "$in_dir"
  131.  
  132. check_files sksh            '     69608    5386977  612797492' 'pure' ''
  133. check_files tiny_sksh       '     52140    3950072  614130749' 'pure' ''
  134.  
  135. initfile=FALSE
  136. if [ -f sksh:.skshinit ]
  137. then
  138.    initfile=TRUE
  139.    check_files sksh:.skshinit    '      3116     186843  394778686' ''     ''
  140. fi
  141. if [ -f sksh:.skshinit.pp ]
  142. then
  143.    initfile=TRUE
  144.    check_files sksh:.skshinit.pp '      3487     192260 1046848713' ''     ''
  145. fi
  146.  
  147. if [ "$initfile" = 'FALSE' ]
  148. then
  149.    check_files sksh:.skshinit    '      3116     186843  394778686' ''     ''
  150. fi
  151.  
  152. if [ ! -f 'sksh:.skshrc' ]
  153. then
  154.    echo -c "$b" "ERROR: " "$e" "this file is missing: sksh:.skshrc"
  155.    echo "sksh:.skshrc" >> "$missing"
  156. fi
  157.  
  158. if [ -m 'vmagic:' ]
  159.    then
  160.    if [ ! -f 'vmagic:view.magic' ]
  161.    then
  162.       echo -c "$b" "WARNING: " "$e" "this file is missing: vmagic:view.magic"
  163.       echo "vmagic:view.magic" >> "$missing"
  164.    fi
  165. fi
  166.  
  167. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  168. then
  169.    echo "\nSKsh binaries and init files are valid.\n"
  170. fi
  171.  
  172. echo -n > "$missing"
  173. echo -n > "$invalid"
  174. echo -n > "$inpath"
  175.  
  176. # --- Find dir containing sksh external commands... --------------------------
  177.  
  178. read_dir "Please enter the name of the directory which contains the SKsh" \
  179.          "external commands" "c:"
  180.  
  181. echo -c "\n$_ANSI_US" "Checking SKsh external commands...$_ANSI_UE" "\n"
  182. cd "$in_dir"
  183.  
  184. check_files cat             '      2640     194202   76668405' 'pure' 'path'
  185. check_files cmp             '      3092     227924  536903169' 'pure' 'path'
  186. check_files cp              '      4572     360911  690211346' 'pure' 'path'
  187. check_files crc             '      2668     193827  536898298' 'pure' 'path'
  188. check_files cut             '      3560     273017 1764043124' 'pure' 'path'
  189. check_files du              '      3432     246205   76660976' 'pure' 'path'
  190. check_files encr            '      3944     303081 1303786364' 'pure' 'path'
  191. check_files fgrep           '      5316     389047   76640570' 'pure' 'path'
  192. check_files grep            '     11628     922091 1303697934' 'pure' 'path'
  193. check_files head            '      3032     210152  690232883' 'pure' 'path'
  194. check_files indent          '      3312     230719 1917363458' 'pure' 'path'
  195. check_files join            '      2920     216395  536901522' 'pure' 'path'
  196. check_files num             '      2784     202126   76667273' 'pure' 'path'
  197. check_files srun            '      2372     167437  536894528' 'pure' 'path'
  198. check_files strings         '      2736     205271 1764033446' 'pure' 'path'
  199. check_files tail            '      3552     256316  536907225' 'pure' 'path'
  200. check_files tee             '      2880     222196 1303797919' 'pure' 'path'
  201. check_files view            '      6200     511324 1303756615' 'pure' 'path'
  202. check_files wc              '      3212     235859   76662454' 'pure' 'path'
  203. check_files window          '      4840     347343 1994042642' 'pure' 'path'
  204. check_files xd              '      3408     258472  536907533' 'pure' 'path'
  205.  
  206. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  207. then
  208.    echo "\nSKsh external commands are valid.\n"
  209. fi
  210.  
  211. echo -n > "$missing"
  212. echo -n > "$invalid"
  213. echo -n > "$inpath"
  214.  
  215. # --- Find dir containing sksh documentation... ------------------------------
  216.  
  217. echo -n "\nDo you wish to check the documentation files [y/n] ? > "; read yn
  218. echo
  219.  
  220. if [ "$yn" = 'y' -o "$yn" = 'Y' ]
  221. then
  222.  
  223. read_dir "Please enter the name of the directory which contains the SKsh" \
  224.          "documentation files" "MAN:"
  225.  
  226. echo -c "\n$_ANSI_US" "Checking SKsh documentation files...$_ANSI_UE" "\n"
  227. cd "$in_dir"
  228.  
  229. check_files Addendum1.1.doc '      7776     547357 1459834416' '' ''
  230. check_files Addendum1.2.doc '     10165     718963 1459854250' '' ''
  231. check_files Addendum1.3.doc '     21522    1579653  846405768' '' ''
  232. check_files Addendum1.4.doc '     27114    1931292  846451321' '' ''
  233. check_files Addendum1.5.doc '     31857    2358446 2073641175' '' ''
  234. check_files Bugs.doc        '      1736     114181 1908801272' '' ''
  235. check_files Diffs.doc       '      6200     443439 1928416014' '' ''
  236. check_files ErrorCodes.doc  '      2404     150992 1139459547' '' ''
  237. check_files ExtCmds.doc     '     39638    2632676  449773169' '' ''
  238. check_files Hints.doc       '      7481     531434  376119483' '' ''
  239. check_files Install.doc     '      6524     438132 1063822751' '' ''
  240. check_files MiscInfo.doc    '      5858     434299  486661790' '' ''
  241. check_files ReadMe_1st.doc  '      4920     334810 1354024267' '' ''
  242. check_files Reference.doc   '    141416    9216291 1980178810' '' ''
  243. check_files TechNotes.doc   '      5450     404390   40070175' '' ''
  244. check_files TinySKsh.doc    '      3158     207136  774303659' '' ''
  245. check_files UserMan.doc     '    102022    7261426  777852275' '' ''
  246. check_files View.doc        '     13036     952471  475268762' '' ''
  247.  
  248. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  249. then
  250.    echo "\nSKsh documentation files are valid.\n"
  251. fi
  252.  
  253. fi # end of doc file check
  254.  
  255. # --- Find dir containing stuff.sksh... -----------------------------------
  256.  
  257. echo -n "\nDo you wish to check the Stuff.sksh file [y/n] ? > "; read yn
  258. echo
  259.  
  260. if [ "$yn" = 'y' -o "$yn" = 'Y' ]
  261. then
  262.  
  263. read_dir "Please enter the name of the directory which contains the" \
  264.          "Stuff.sksh file" "sksh:"
  265.  
  266. echo -c "\n$_ANSI_US" "Checking Stuff.sksh documentation file...$_ANSI_UE" "\n"
  267. cd "$in_dir"
  268.  
  269. check_files Stuff.sksh      '      8428     562929  779546500' '' ''
  270.  
  271. if [ -s "$missing" -a -s "$invalid" -a -s "$inpath" ]
  272. then
  273.    echo "\nStuff.sksh file is valid.\n"
  274. fi
  275.  
  276. fi # end of Stuff.sksh file check
  277.  
  278.  
  279. echo "\nSKsh installation checking complete."
  280. clean_up
  281.